package app.fugema.shop.main.goods.adapter;

import android.widget.LinearLayout;

import com.base.common.utils.DensityUtil;
import com.base.common.view.adapter.bean.HeaderBean;
import com.base.common.view.adapter.connector.BaseItemMultiType;
import com.base.common.view.adapter.connector.BaseViewHolder;
import app.fugema.shop.R;
import app.fugema.shop.databinding.SeckillPrecinctTopBannerBinding;
import com.youth.banner.BannerConfig;
import com.youth.banner.listener.OnBannerListener;

public class SeckillPrecinctTopBannerItemMultiType extends BaseItemMultiType<HeaderBean, SeckillPrecinctTopBannerBinding> {

    @Override
    public int getLayoutId() {
        return R.layout.seckill_precinct_top_banner;
    }

    @Override
    public int getItemViewType() {
        return TYPE_HEAD_ONE;
    }

    @Override
    public boolean isFullSpanType() {
        return true;
    }

    @Override
    public void onCreateViewHolder(SeckillPrecinctTopBannerBinding binding, BaseViewHolder viewHolder) {
        super.onCreateViewHolder(binding, viewHolder);
        binding.banner.setIndicatorGravity(BannerConfig.LEFT);
        LinearLayout circleIndicator = binding.banner.findViewById(R.id.circleIndicator);
        if (circleIndicator != null) {
            circleIndicator.setPadding(DensityUtil.getDimens(R.dimen.dp_32), 0, 0, DensityUtil.getDimens(R.dimen.dp_10));
        }
        binding.banner.setOnBannerListener(new OnBannerListener() {
            @Override
            public void OnBannerClick(int position) {

            }
        });
    }

    @Override
    public void onBindViewHolder(SeckillPrecinctTopBannerBinding binding, int position, HeaderBean bean) {
        super.onBindViewHolder(binding, position, bean);
//        binding.banner.setImages(bean.getData()).setImageLoader(new BannerImageLoader() {
//
//            @Override
//            public void displayImage(Context context, Object path, GlideImageView imageView) {
//                BannerInfo.IntegralBean bannerInfo = (BannerInfo.IntegralBean) path;
//                String[] pic = bannerInfo.getPic().split(",");
//                if (pic.length > 0) {
//                    ImageLoaderUtils.loadImage(imageView, pic[0]);
//                }
//            }
//
//            int dp16 = DensityUtil.getDimens(R.dimen.dp_8);
//
//            @Override
//            public GlideImageView createImageView(Context context) {
//                GlideImageView glideImageView = super.createImageView(context);
//                glideImageView.setShapeType(ShapeType.ROUNDRECT);
//                glideImageView.setRadius(DensityUtil.getDimens(R.dimen.dp_6));
//                glideImageView.setScaleType(ImageView.ScaleType.FIT_XY);
//                glideImageView.setPadding(dp16, 0, dp16, 0);
//                return glideImageView;
//            }
//
//
//        }).setDelayTime(3000).start();


    }


}
